#!/bin/bash

path=/usr/local/bin/
compose=docker-compose

if [ -z "$1" ] || [ "$1" = 0 ]; then
  param='-d';
else
  param='';
fi;

if [ ! -f "$path$compose" ]; then
  cp script/docker-compose $path
  chmod a+x docker-compose
fi;

# Stop local services
sudo service apache2 stop
sudo service nginx stop
sudo service mysql stop
sudo service redis-server stop
sudo service elasticsearch stop

# Launch docker service

#sudo docker-compose up -d

echo;
echo -e "\033[32m==============================Building Start=====================================\033[0m"
echo;

echo "sudo docker-compose up $param";

sudo docker-compose up $param
echo;

echo;
echo -e "\033[32m==============================Building End=====================================\033[0m"
echo;

